package com.atguigu.gulimall.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;


/*
* 核心原理
*   1）、@EnableRedisHttpSession 导入 RedisHttpSessionConfiguration
*       1、给容器中添加了一个组件
*           SessionRepository=》》》【RedisOperationsSessionRepository】==》 ：redis操作session，session的增删改查封装类
*       2、SessionRepositoryFilter==》Filter：session 存储过滤器，每个请求过来都必须经过Filter
*           1、创建的时候，就自动从容器中获取到了 SessionRepository
*           2、原始的 request、response都被包装。SessionRepositoryRequestWrapper,SessionRepositoryResponseWrapper
*           3、以后获取session。SessionRepositoryRequestWrapper中获取，它重写了.getSession()方法，从Redis中获取。（原生：request.getSession())
*           4、wrappedRequest.getSession()；===》 SessionRepository 中获取
* */
@EnableRedisHttpSession // 整合redis作为session存储
@EnableFeignClients(basePackages = "com.atguigu.gulimall.auth.feign")
@EnableDiscoveryClient
@SpringBootApplication
public class GulimallAuthServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallAuthServerApplication.class, args);
    }

}
